package com.alks.function.controller.stitch;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.SysLogAop;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.produce.StitchScanRequest;
import com.alks.function.service.stitch.StitchCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

@Slf4j
@ApiRestController("/StitchCollect")
@Api(value = "针车采集-针车鞋面入库扫描", tags = {"针车采集"})
public class StitchCollectController {

    @Autowired
    private StitchCollectService stitchCollectService;

    @WebLogger
    @PostMapping("/stitchScanIAndO")
    @ApiOperation(value = "扫码:收发料", tags = "针车采集")
    public ResponseInfo stitchScanIAndO(@RequestBody StitchScanRequest request,
                                        @RequestHeader(value = "Accept-Language", defaultValue = "zh") String language) {
        return stitchCollectService.stitchScanIAndO(request,language);
    }

    @WebLogger
    @PostMapping("/stitchScanIn")
    @ApiOperation(value = "扫码:收料", tags = "针车采集")
    public ResponseInfo stitchScanIn(@RequestBody StitchScanRequest request,
                                     @RequestHeader(value = "Accept-Language", defaultValue = "zh") String language) {
        return stitchCollectService.stitchScanIn(request,language);
    }

    @WebLogger
    @PostMapping("/stitchScanOut")
    @ApiOperation(value = "扫码:发料", tags = "针车采集")
    public ResponseInfo stitchScanOut(@RequestBody StitchScanRequest request,
                                      @RequestHeader(value = "Accept-Language", defaultValue = "zh") String language) {
        return stitchCollectService.stitchScanOut(request,language);
    }

    @WebLogger
    @PostMapping("/stitchScanQuery")
    @ApiOperation(value = "扫码:查询当前条码信息", tags = "针车采集")
    public ResponseInfo stitchScanQuery(@RequestBody StitchScanRequest request,
                                        @RequestHeader(value = "Accept-Language", defaultValue = "zh") String language) {
        return stitchCollectService.stitchScanQuery(request,language);
    }

    @WebLogger
    @PostMapping("/stitchPrint")
    @ApiOperation(value = "打印单据", tags = "针车采集")
    public ResponseInfo stitchPrint(@RequestBody StitchScanRequest request,
                                    @RequestHeader(value = "Accept-Language", defaultValue = "zh") String language) {
        return stitchCollectService.stitchPrint(request,language);
    }

    @WebLogger
    @PostMapping("/stitch")
    @ApiOperation(value = "测试过收进来的鞋码", tags = "针车采集")
    public ResponseInfo stitch(@RequestBody StitchScanRequest request,
                               @RequestHeader(value = "Accept-Language", defaultValue = "zh") String language) {
        return stitchCollectService.stitch(request,language);
    }
}
